package com.it.jzs.controller.admin;

import com.it.jzs.dao.CommentMapper;
import com.it.jzs.service.admin.AdminCommentService;
import com.it.jzs.vo.Result;
import com.it.jzs.vo.params.WriteParams;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("admin")
@CrossOrigin
public class AdminCommentController {

    @Resource
    private AdminCommentService commentService;

    @GetMapping("comment")
    public Result<Object> ListBlogPage(@RequestParam(value = "index") Integer index, @RequestParam(value = "size") Integer size) {
        Result<Object> result = commentService.selectPage(index, size);
//        System.out.println("index = " + index);
//        System.out.println("size = " + size);
        return result;
    }

    @DeleteMapping("comment/{id}")
    public Result<Object> deleteBlog(@PathVariable("id") Integer id) {
//        System.out.println("id = " + id);
        Result<Object> result = commentService.delete(id);
        return result;
    }
}
